package com.picket.service;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Service;

import com.picket.dao.IUserPredictionDao;
import com.picket.domain.Match;
import com.picket.domain.UserPrediction;

@Service
public class UserPredictionService implements IUserPredictionService {

	private IUserPredictionDao userPredictionDao;

	@Required
	public void setUserPredictionDao(final IUserPredictionDao userPredictionDao) {
		this.userPredictionDao = userPredictionDao;
	}

	@Override
	public void create(final List<UserPrediction> userPredictions) {
		userPredictionDao.create(userPredictions);
	}

	@Override
	public Collection<UserPrediction> getAllUserPredictions() {
		return userPredictionDao.getAllUserPredictions();
	}
/*
	@Override
	public Collection<UserPrediction> getAllUserPredictionsForEvent(long id) {
		return userPredictionDao.getAllUserPredictionsForEvent(id);
	}*/

	@Override
	public UserPrediction getUserPrediction(long id) {
		return userPredictionDao.getUserPrediction(id);
	}

	@Override
	public Collection<UserPrediction> getAllUserPredictionsForUserPool(
			long userPoolId) {
		return userPredictionDao.getAllUserPredictionsForUserPool(userPoolId);
	}
	
	@Override
	public Collection<UserPrediction> getAllUserPredictionsForUserPoolOrderedByMatchNo(
			long userPoolId) {
		return userPredictionDao.getAllUserPredictionsForUserPoolOrderedByMatchNo(userPoolId);
	}	
	
	
	
	@Override
	public Collection<UserPrediction> getAllUserPredictionsForMatrix(long matchId){
		return userPredictionDao.getAllUserPredictionsForMatrix(matchId);
	}
	@Override
	public Collection<UserPrediction> updatePredictions(List<String> userPredictions, long userPoolId)  throws Exception{
		return userPredictionDao.updatePredictions(userPredictions,  userPoolId);
	}
	
	public void  updatePredictionsWithPoints(Match match){
		userPredictionDao.updatePredictionsWithPoints(match);
	}
}
